<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="vtc" uri="/ls-trade-tags"%>
<%@ include file="/common/taglibs.jsp"%>


<html>
<head>
<title>编辑单据模板</title>

<script type="text/javascript">
		$(document).ready(function() {
			$("#mainForm").validate();
		});
	
		function clickBtn(action,id,e){
			
			switch(action){
			case "close":
				window.location="order-template.action";
				return;
				
			case "save":
				$("#mainForm").attr("action","order-template!save.action");
				break;	
			}
			
			$("#mainForm").submit();
		}	

		function ajaxGetTotalPrice(){
			$.ajax({
				url : "order-template!ajaxGetTotalPrice.action?orderTemplate.id=<s:property value='orderTemplate.id'/>",
				cache : false,
				dataType : "text",
				async : true,
				success : function(data) {
					$("#totalPrice").attr("value",data);
				},
				error : function(data) {
					$("#errorMsgSpan").html(data);
				}
			});				
		}

	</script>
</head>
<body>
<s:if test="%{orderTemplate!=null&&orderTemplate.id!=null}">
	<div class="pageTitle">编辑单据模板</div>
</s:if>
<s:else>
	<div class="pageTitle">添加单据模板</div>
</s:else>


<s:form id="mainForm" name="mainForm" action="order-template!save.action"
	method="post">
	<s:hidden name="orderTemplate.id" id="orderTemplateId"></s:hidden>
	<div class="form2">

		<span class="errorLabel" id="errorMsgSpan"></span>
		<s:actionerror/>
		<s:fielderror/>
		<s:actionmessage/>    

	<table cellspacing="0" cellpadding="0" border="0">
		<tbody>
			<tr>
				<td class="sep"><img style="width: 180px;"
					src="../images/spacer.gif"></td>
				<td class="sep sep2"><img src="../images/spacer.gif"></td>
			</tr>
			<tr>
				<td><label class="fLabel">单据模板名称</label>
				<div class="fField"><s:textfield cssClass="inputText required"
					cssStyle="width:180px" name="orderTemplate.name" /></div>
				</td>
				<td><label class="fLabel">总计金额</label>
				<div class="fField">
				    <input type="text" id="totalPrice" value="<s:property value='@com.lightsaber.trade.core.common.util.Calc@leaveTwoDigital(orderTemplate.totalPrice)'/>" style="width:180px" disabled="disabled"/> 元
				</div>
				</td>				
			</tr>
			<tr>
				<td colspan="2"><label class="fLabel">描述</label>
				<div class="fField"><s:textarea
					name="orderTemplate.description" id="level1PlanningRemarks"
					cssClass="inputTextarea" cssStyle="width:500px; height:50px"></s:textarea>
				</div>
				</td>
			</tr>
		</tbody>
	</table>

	<div class="btnSet btnSetTypeA">
	<div class="left">
	<div class="button">
	<div class="left">
	<div class="right"><input type="button"
		onclick="clickBtn('save')" value="保存" class="inputButton"></div>
	</div>
	</div>

	<div class="button">
	<div class="left">
	<div class="right"><input type="reset" value="重置"
		class="inputButton"></div>
	</div>
	</div>

	<div class="button">
	<div class="left">
	<div class="right"><input type="button"
		onclick="clickBtn('close')" value="返回" class="inputButton"></div>
	</div>
	</div>

	</div>
	</div>

	</div>
</s:form>

<s:if test="%{orderTemplate!=null&&orderTemplate.id!=null}">
	<div class="pageTitle2">单据模板项</div>
	<iframe id="orderTemplateItemIframe" name="orderTemplateItemIframe"
		src="order-template-item.action?no-decorate&orderTemplateId=<s:property value='orderTemplate.id'/>"
		style="width: 100%; height: 150px;" frameborder="0" scrolling="no">
	</iframe>
</s:if>

</body>
</html>